package com.aqie.haikang.dorm.config;

import com.ejlchina.okhttps.HTTP;
import com.ejlchina.okhttps.jackson.JacksonMsgConvertor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author aqie
 * @Date 2021/12/11 11:13
 * @desc
 */
@SpringBootConfiguration
public class WebMvcConfig implements WebMvcConfigurer {
    @Value("${baseUrl}")
    private String baseUrl;

    @Bean
    @Primary
    public HTTP okhttps(){
       return HTTP.builder()
                .baseUrl(baseUrl)
                .addMsgConvertor(new JacksonMsgConvertor())
                .build();
    }
}
